﻿using DL.Characters.Player.FSM.StateMachine;
using UnityEngine.InputSystem;

namespace DL.Characters.Player.FSM.State
{
    public class PlayerCombatNullState : PlayerCombatBaseState
    {
        public PlayerCombatNullState(PlayerCombatStateMachine playerStateMachine, int property = 0) : base(playerStateMachine, property)
        {
        }

        public override void StateTransitionCompleted()
        {
            // StateMachine.Player.MoveStateMachine.ChangeState<PlayerIdleState>();
            StateMachine.Player.MoveStateMachine.ChangeState<PlayerLocomotionState>();
        }

        public override void Update()
        {
            // CombatController.EndAttack();
            
            WeaponCombotController.EndAttack();
        }

        protected override void AddInputActionCallBacks()
        {
            // StateMachine.InputSystem._playerInputActions.L_Atk.started += EnterNormalCombatState;
        }
        
        protected override void RemoveInputActionCallBacks()
        {
            // StateMachine.InputSystem._playerInputActions.L_Atk.started -= EnterNormalCombatState;
        }

        protected void EnterNormalCombatState(InputAction.CallbackContext context)
        {
            //强制进入战斗移动
            StateMachine.Player.MoveStateMachine.ChangeState<PlayerNullState>();
            //进入战斗准备阶段
            StateMachine.ChangeState<PlayerPreCombatState>();
        }
    }
}